package cn.itsource.autoconfigure;

import cn.itsource.config.WeChatProperties;
import cn.itsource.service.WeChatService;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({WeChatProperties.class})
public class WeChatAutoConfiguration {
    /**
     * spring 在加载WeChatService 这个bean
     * 发现你是有参数的  spring就会再容器里面去找对应的Bean(WeChatProperties)
     * @param weChatProperties
     * @return
     */
    @Bean
    public WeChatService weChatService(WeChatProperties weChatProperties){
        return new WeChatService(weChatProperties);
    }
}
